home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
ptv3n5.zip
/
GETEVENT.SRC
< prev
next >
Wrap
Text File
|
1992-09-01
|
2KB
|
63 lines
PROCEDURE TEditorApp.GetEvent(VAR Event: TEvent);
VAR
{ Used to allocate the help window. }
W: PWindow;
{ The help object with its hypertext engine,
window handling, etc. }
HFile: PHelpFile;
{ Lets you save the current help context to a stream with
the rest of your application on a desktop file. }
HelpStrm: PDosStream;
CONST
{ Prevents opening two help files at once. }
HelpInUse: Boolean = False;
BEGIN
{ Always make this the first statement of your GetEvent
replacement. }
TApplication.GetEvent(Event);
{ See if help has been requested. }
CASE Event.What OF
evCommand:
IF (Event.Command = cmHelp) AND NOT HelpInUse THEN BEGIN
{ Help has been requested.
Disallow use of multiple help files. }
HelpInUse := True;
{ Determine the help file's name based on the
application's name. }
HelpStrm := New(PDosStream, Init(CalcHelpName,
stOpenRead));
{ Open the help file object. }
HFile := New(PHelpFile, Init(HelpStrm));
IF HelpStrm^.Status <> stOk THEN BEGIN
{ If there was a problem, e.g., the help file
couldn't be found, let the user know. }
MessageBox('Could not open help file.', nil,
mfError + mfOkButton);
{ Deallocate the help file's resources. }
Dispose(HFile, Done);
END
ELSE BEGIN
{ There was no problem allocating the help file.
Allocate the help window object. }
W := New(PHelpWindow,Init(HFile, GetHelpCtx));
IF ValidView(W) <> nil THEN BEGIN
{ If there was enough memory to allocate the
help object, attach it to the application's
window list. }
ExecView(W);
{ After the user has exited help, deallocate
the help object. }
Dispose(W, Done);
END;
{ Remove the help message from the event queue. }
ClearEvent(Event);
END;
{ Signal that a help window may now be opened. }
HelpInUse := FALSE;
END;
evMouseDown:
IF Event.Buttons <> 1 THEN
Event.What := evNothing;
END; { end case }
END;